<template>
  <div class="xisha_2">
    <div class="content_title">
      <span class="content_text">细纱</span>
      <img
        class="content_img"
        src="@/assets/img/chart/xisha.png"
        alt=""
        srcset=""
      />
    </div>
    <div class="xisha_body">
      <div class="xisha_row2">
        <div
          class="item1"
          v-for="(item, index) in xishaData.xishaRow2Data"
          :key="index + 'z'"
        >
          <div
            v-if="
              index == 4 ||
                index == 10 ||
                index == 15 ||
                index == 24 ||
                index == 29 ||
                index == 38 ||
                index == 44
            "
          >
            <div class="dongli" @click="clickHandleDl('xisha2f_' + index)">
              <img src="@/assets/img/dongligui.png" alt="" srcset="" />
            </div>
          </div>
          <!-- 弹框内的细砂不展示温度 -->
          <div v-if="index == 10 || index == 35">
            <div class="wendu1">
              <img src="@/assets/img/wendu.png" alt="" srcset="" />
            </div>
          </div>
          <div @click="clickHandle(item)">
            <xisha :data="item"></xisha>
          </div>
        </div>
      </div>
      <!-- <i class="wall"></i> -->
      <div class="xisha_row3">
        <div
          class="item1"
          v-for="(item, index) in xishaData.xishaRow3Data"
          :key="index + 'x'"
        >
          <div
            v-if="
              index == 4 ||
                index == 10 ||
                index == 15 ||
                index == 24 ||
                index == 29 ||
                index == 38 ||
                index == 44
            "
          >
            <div class="dongli" @click="clickHandleDl('xisha2s_' + index)">
              <img src="@/assets/img/dongligui.png" alt="" srcset="" />
            </div>
          </div>
          <!-- 弹框内的细砂不展示温度 -->
          <div v-if="index == 6 || index == 34">
            <div class="wendu">
              <img src="@/assets/img/wendu.png" alt="" srcset="" />
            </div>
          </div>
          <div @click="clickHandle(item)">
            <xisha :data="item"></xisha>
          </div>
        </div>
      </div>
      <div class="xisha_row4">
        <div
          class="item1"
          v-for="(item, index) in xishaData.xishaRow4Data"
          :key="index + 'c'"
        >
          <div
            v-if="
              index == 4 ||
                index == 10 ||
                index == 14 ||
                index == 24 ||
                index == 29 ||
                index == 38 ||
                index == 44
            "
          >
            <div
              class="donglibottom"
              @click="clickHandleDl('xisha2t_' + index)"
            >
              <img src="@/assets/img/dongligui.png" alt="" srcset="" />
            </div>
          </div>
          <!-- 弹框内的细砂不展示温度 -->
          <div v-if="index == 7 || index == 34">
            <div class="wendubottom">
              <img src="@/assets/img/wendu.png" alt="" srcset="" />
            </div>
          </div>
          <div @click="clickHandle(item)">
            <xisha :data="item"></xisha>
          </div>
        </div>
      </div>
    </div>
    <xishaDialog ref="xishaDialog2" />
    <!-- 动力柜弹窗控件 -->
    <dongliDialog ref="dongliDialog"></dongliDialog>
  </div>
</template>

<script>
import dongliDialog from '../qcs/dialog/dialog_dongli/index';
import xisha from '../qcs/xisha';
import xishaDialog from '../qcs/dialog/dialog_xisha/index';
import COMMON from '@/utils/common';
import dongLiMenu from '../data/dongli.json';
import dongliItem from '../data/dongliItem.json';
export default {
  name: 'XiSha',
  props: {
    msg: String
  },
  data() {
    return {
      loading: true,
      xishaData: {
        // 1-49
        xishaRow2Data: [],
        // 50-98
        xishaRow3Data: [],
        // 99-147
        xishaRow4Data: []
      },
      xishaDialog: false,
      dongLiMenu: {},
      dongLiItem: {}
    };
  },
  created() {
    this.dongLiMenu = dongLiMenu;
    this.dongLiItem = dongliItem;
  },
  components: {
    dongliDialog,
    xisha,
    xishaDialog
  },
  computed: {
    xiShaGroupState() {
      return this.$store.state.workshop.xiShaGroupState;
    }
  },
  watch: {
    xiShaGroupState: {
      immediate: true,
      handler(val) {
        this.xishaData.xishaRow2Data = COMMON.devSnFilter(val.data, 1, 49);
        this.xishaData.xishaRow3Data = COMMON.devSnFilter(val.data, 50, 98);
        this.xishaData.xishaRow4Data = COMMON.devSnFilter(val.data, 99, 147);
      }
    }
  },
  methods: {
    closeHandle() {
      this.$parent.$parent.$parent.closeParentHandle();
    },
    clickHandle(item) {
      this.$parent.$parent.$parent.getInfoByDevSn('XISHA', item.devSn);
      this.$refs.xishaDialog2.showDialog(item);
    },
    clickHandleDl(item) {
      var getInfoQuary = this.dongLiMenu[item];
      var dialogData = this.dongLiItem[item];
      this.$parent.$parent.$parent.getInfoByDevSn('DONGLI', getInfoQuary);
      this.$refs.dongliDialog.showDialog(dialogData);
    }
  }
};
</script>

<style scoped></style>
